<?php
class recommendModel extends baseModel{
    protected $table = 'recommend';

    //推荐位列表
    public function recommend_list() {
        return $this->select('','','sequence desc');
    }

    //推荐位信息
    public function info($id) {
        return $this->find('id='.$id);
    }

    //获取指定推荐位列表
    public function content_list($id) {
        return $this->select('id in('.$id.')','','sequence desc');
    }

    //添加推荐位
    public function add($data)
    {

        $data['sequence']=intval($data['sequence']);
        return $this->insert($data);
    }
    //编辑推荐位
    public function edit($data)
    {
        $condition['id']=intval($data['id']);
        $data['sequence']=intval($data['sequence']);
        return $this->update($condition,$data); 
    }
    //删除推荐位
    public function del($id)
    {
        //删除关联
        model('admin_relation')->relation_del($id);
        api('special','recommend_relation_del',$id);
        return $this->delete('id='.intval($id)); 
    }

	
}